<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- findIndex 对数组执行遍历 -->
    <script>
        var arr = [1,2,3,2]
        var index = arr.findIndex(item=>{
            return item == 2;
        })
        console.log(index);

        var arr = [4, 12, 16, 20,25,30];

        var a = arr.findIndex((item,index)=>{
                return item >16
        })
        console.log(a)
    </script>
</html>